function xmlFindJs(method, url,methodName, data = null) {
    let xmlHttpRequest = new XMLHttpRequest()
    xmlHttpRequest.open(method, url)
    xmlHttpRequest.setRequestHeader("Authorization", "APPCODE b79f931c1f2f45e4b5b8c4b4ab5b92ef")
    xmlHttpRequest.send()
    xmlHttpRequest.onreadystatechange = function () {
        methodName(xmlHttpRequest.responseText)
    }
}

function xmlFindJq(method, url, methodName,data = null ) {
    $.ajax({
        type: method,
        url: url,
        data: data,
        headers: { "Authorization": "APPCODE b79f931c1f2f45e4b5b8c4b4ab5b92ef" },
        success: function (data) {
            methodName(data)
        }
    })
}

function axiosFind(method, url,methodName, data = null) {
    axios({
        method: method,
        url: url,
        headers: { "Authorization": "APPCODE b79f931c1f2f45e4b5b8c4b4ab5b92ef" }
    }).then(res => {
        methodName(res)
    }).catch(error => {
        return error
    })
}
function getDate() {
    let date = new Date()
    debugger
    let year = date.getFullYear()
    let month = date.getMonth() + 1
    if(month<10){
        month='0'+month
    }
    let day = date.getDate()
    if(day<10){
       day='0'+day
    }
    let hours = date.getHours()
    let minute = date.getMinutes()
    let second = date.getSeconds()
    return `${year}${month}${day}${hours}${minute}${second}`
}

function wannianGetDate(){
    let date = new Date()
    let year = date.getFullYear()
    let month = date.getMonth() + 1
    if(month<10){
        month='0'+month
    }
    let day = date.getDate()
    if(day<10){
       day='0'+day
    }
    let hours = date.getHours()
    let minute = date.getMinutes()
    if(minute<10){
        minute='0'+minute
    }
    let second = date.getSeconds()
    if(second<10){
        second='0'+second
    }
    return `${year}${month}${day}${hours}${minute}${second}`
}


function getWeek(){
    let date=new Date()
    let numbers=['7','1','2','3','4','5','6']
    let current=date.getDay()
    return numbers[current]
}

export {
    xmlFindJs,
    xmlFindJq,
    axiosFind,
    getDate,
    wannianGetDate,
    getWeek
}